using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
namespace XProject.Entity
{
   public class DiaryItem
    {
        #region fields
        int id;
        Account account;
        DateTime date;
        string title;
        string status;
        string content;
        FeelingIcon icon;
        bool encrypted = false;
        #endregion
        #region constructors
       public DiaryItem()
       {
           icon = new FeelingIcon();
           account = new Account();
           title = "";
           status = "";
           content = "";
           icon = new FeelingIcon();
           
       }
        #endregion
        #region properties
        public int ItemID
        {
            get { return id; }
            set { id = value; }
        }
        public Account Account
        {
            get { return account; }
            set { account = value; }
        }
        public DateTime Date
        {
            get { return date; }
            set { date = value; }
        }
        public string Title
        {
            get { return title; }
            set { title = value; }
        }
       /// <summary>
        ///  Get set the encrypted title
       /// </summary>
       public string EncryptedTitle
       {
           get { return Util.Encryptor.Encrypt(title, account.Password); }
           set { title = Util.Encryptor.Decrypt(value, account.Password); }
       }
        public string Status
        {
            get { return status; }
            set { status = value; }
        }
       /// <summary>
        ///  Get set the encrypted status
       /// </summary>
       public string EncryptedStatus
       {
           get { return Util.Encryptor.Encrypt(status, account.Password); }
           set { status = Util.Encryptor.Decrypt(value, account.Password); }
       }
        public string Content
        {
            get { return content; }
            set { content = value; }
        }
       /// <summary>
       /// Get set the encrypted content
       /// </summary>
       public string EncryptedContent
       {
           get { return Util.Encryptor.Encrypt(content, account.Password); }
           set { content = Util.Encryptor.Decrypt(value, account.Password); }
       }
       
        public FeelingIcon Icon
        {
            get { return icon; }
            set { icon = value; }
        }
       public bool Encrypted
       {
           get { return encrypted; }
           set { encrypted = value; }
       }
        #endregion
       #region methods
       public string GetEncryptedContent(string key)
       {
           return Util.Encryptor.Encrypt(content,key);
       }
       public void SetEncryptedContent(string cypherText,string key)
       {
           content = Util.Encryptor.Decrypt(cypherText,key);
       }
       #endregion

   }
}
